/**
 * Created by ROGSTAR on 2016/9/30.
 */
define(function (require) {
    var app = require('/../js/app');
    require('ui-table');

    app.useModule("ui.table");

    app.controller('inviteCtrl', ['$scope','$http','$filter',function ($scope, $http,$filter){

        $scope.condition={};

        $scope.selectOptions = {
            minimumResultsForSearch: Infinity,//不出现搜索框
            placeholder:"请选择员工",
        };

        $scope.orderParams = {
            url: "/admin/invite/listInvites"
        };
        //公司列表
        $scope.getCompanyList=function(){
            $scope.companise={};
            $scope.idstr='';
            $http({
                method: 'POST',
                url: "/admin/report/listCompany",
                data:{}
            }).success(function(data) {
                console.log(data)
                $scope.companise=data;
                for(var i=0;i<data.length;i++){
                    $scope.idstr+=data[i].id+','
                }
                $scope.idstr=$scope.idstr.substring(0,$scope.idstr.length-1);
            }).error(function() {
            });
        };
        $scope.getCompanyList();
        //业务员列表
        $scope.getManList=function(id){

            $scope.man={};
            $http({
                method: 'POST',
                url: "/admin/report/listSaleman",
                data:{companyId:id}
            }).success(function(data) {
                console.log(data)
                $scope.man=data;
            }).error(function() {
            });
        };


        //搜索
        $scope.search = function() {
            $scope.orderParams.ajaxParam=$scope.condition;
            $scope.orderParams.reload();
        };

        //搜索重置
        $scope.reset=function(){
            $scope.condition = {};
            $scope.search();

        };


    }]);


});